abstract class Animal {
    public abstract void cry();
    public abstract String getAnimalName();
}//抽象化动物


class Dog extends Animal{
   public void cry() {
        System.out.println("汪汪汪");
   }
   public String getAnimalName(){
        return "Dog";
   }
}//狗的子类

class Cat extends Animal{
   public void cry() {
        System.out.println("喵喵喵");
   }
   public String getAnimalName(){
        return "Cat";
   }
}//猫的子类



class Simulator{
     public void playSound(Animal animal){
     System.out.println(animal.getAnimalName()+"发出声音为");
     animal.cry();
    }
}//用来模拟动物声音

public class Application{
     public static void main(String args[]){
          Simulator simulator = new Simulator();
          simulator.playSound(new Dog());
          simulator.playSound(new Cat());
      }
}